// part1:C14:ex14.39.cpp
// class to examine length of a string object is equal to a value.
// then total of words from input file.
#include <iostream>
#include <istream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

class StrLenBetween
{
public: 
  StrLenBetween(int minLen, int maxLen): minLen(minLen), maxLen(maxLen){}
  bool operator()(const string &str)
  {
    return str.length() >= minLen && str.length() <= maxLen;
  }
private:  
    int minLen;
    int maxLen;
};    

class StrNotShorterThan
{
public:
  StrNotShorterThan(int len): minLen(len){}
  bool operator()(const string &str)
  {
    return str.length() >= minLen;
  }
private:
  int minLen;
};

void readStr(istream &is, vector<string> &vec)
{
  string word;
  while (is >> word) {
    string word;
    while (is >> word) {
      vec.push_back(word);
    }
  }
}

int main(void)
{
  vector<string> vec;
  readStr(cin, vec);

  StrLenBetween slenBetween(1, 9);
  StrNotShorterThan sNotShorterThan(10);
  cout << "len 1~9: " << count_if(vec.begin(), vec.end(),
        slenBetween) << endl;
  cout << "len >= 10 : " << count_if(vec.begin(), vec.end(),
        sNotShorterThan) << endl; 
  return 0;
}
